package com.ruoyi.common.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum ThoroughfareStatus {
    /**
     * 零
     */
    ZERO(0, "防区未使用"),
    /**
     * 一
     */
    ONE(1, "防区撤防"),
    /**
     * 二
     */
    TWO(2, "防区布防"),
    /**
     * 三
     */
    THREE(3, "防区布防"),
    /**
     * 四
     */
    FOUR(4, "防区布防"),
    /**
     * 五
     */
    FIVE(5, "防区布防"),
    /**
     * 六
     */
    SIX(6, "防区布防"),
    /**
     * 七
     */
    SEVEN(7, "防区布防"),

    UNKNOWN(999, "未知"),
    ;

    private Integer code;
    private String desc;

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ThoroughfareStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ThoroughfareStatus valueOfCode(Integer code) {
        return Arrays.stream(values()).filter(status -> status.getCode().equals(code)).findFirst().orElse(UNKNOWN);
    }
}
